/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sie_invdis;



import org.jfree.ui.ApplicationFrame;
import org.jfree.chart.*;
import org.jfree.data.category.*;
import org.jfree.util.*;
import java.awt.*;
import java.awt.event.*;
/**
 *
 * @author Michelle
 */
public class graficacion_varios_pastel extends ApplicationFrame{

     private JFreeChart chart=null;
    private ChartPanel panel=null;
 public graficacion_varios_pastel(String title,CategoryDataset data,String fnombregraf)
    {
        super(title);

        chart=crearChart(data,fnombregraf);

        panel = new ChartPanel(chart,false);
        panel.setPreferredSize(new Dimension(800,600));
        panel.updateUI();
        this.setContentPane(panel);
        this.setVisible(false);
        //this.update(this.getGraphics());
        this.setVisible(true);
    }



    private static JFreeChart crearChart(CategoryDataset data,String fnombregra)
    {

          JFreeChart chart= ChartFactory.createMultiplePieChart3D(
                fnombregra,                  //Nombre del eje vertical
                data,
                TableOrder.BY_ROW, //Data
                true,                       //Incluir leyenda
                true,                       //Información al pasar el mouse
                true);                      //URls

          chart.setBackgroundPaint(Color.yellow);
         return chart;
    }



     @Override public void windowClosing(WindowEvent e) {

         this.dispose();
     }
}
